﻿@using MsForgeReboot.Framework.Entities
@using MsForgeReboot.Web.Extensions
@using PagedList

@model IPagedList<BlogPost>

<h2>@ViewBag.Title</h2>

<p>
    @Html.ActionLink("Dodaj novi blog post", "Create",  null, new { @class = "btn btn-primary" })
</p>

@Html.Partial("_PagedView", Model)
<ul>
    @foreach (var item in Model) {
        <li>
            <div class="blogPost-listItem">
                <h3>@Html.ActionLink(item.Title, "Edit", new { urlPointer = item.UrlPointer })</h3>   
                <p>
                    @Html.DisplayFor(modelItem => item.Author.PublicName) - 
                    Publised on: @Html.DisplayFor(modelItem => item.Published) - 
                    @item.Comments.Count() comments
                </p>
                <p class="btn-group">
                    @Html.ActionLink("Edit", "Edit", new { Area = "ControlPanel", id = item.UrlPointer }, new { @class = "btn btn-small" }) |  
                    @Html.ActionLink("View", "Post", new { Area="", id=item.UrlPointer }, new { @class = "btn btn-small" }) |
                    @Html.ActionLink("Delete", "Delete", new { Area = "ControlPanel", id = item.UrlPointer }, new { name = "DeleteLink", @class="btn btn-small btn-danger" })
                </p>
                
                <p>@Html.DisplaySummaryFor(item.Body) @Html.ActionLink("...", "Edit", new { urlPointer = item.UrlPointer })</p>
            </div>
        </li>
    }
</ul>
@Html.Partial("_PagedView", Model)
<script>
    @section Scripts {
    @Scripts.Render("~/bundles/controlpanel/blog/index")
}</script>
